Create a payment intent
POST/baskets/:id/payment-intents
Creates a new payment intent so that checkout can begin. During this process, the configured Payment Service Provider will be prepared to recieve the payment, and any metadata required by the front end to perform the payment againts the PSP system will be attached to the payment intent. Once complete, the basket will be locked for mutations. If the basket needs to be mutated again (such as if the customer backs out of the payment process), then the cancel payment intent endpoint must be called in order to unlock the basket and allow mutations again.
Request
Path Parameters
The id of the basket
Header Parameters
The API key for the given store
- application/json
Body
Additional data to be passed to the payment provider
Responses
- 200
- 202
The PaymentIntent if an active one already exists, or a notification response that will be completed with a new Payment Intent.
- application/json
- Schema
- Example (from schema)
Schema
The id of the payment intent
Indicates what stage of it's lifecycle a payment intent is in.
If Status is 'AwaitingPayment', this field will contain any payload that the PSP has provided to enable a payment transaction to be made. The data in this payload is irrelevant to OneBasket. The frontend will typically utilise it to enable communication with the PSP for a payment via the provider's own SDK.
{
"id": "string",
"status": "PreparingPayment",
"pspPaymentReference": "string",
"pspPaylod": {}
}
The PaymentIntent if an active one already exists, or a notification response that will be completed with a new Payment Intent.
- application/json
- Schema
- Example (from schema)
Schema
The id of a notification that represents this asynchronous request. OneBasket will be processing the request in the background, and upon completion this notification will be updated with the result.
{
"notificationId": "string"
}